<tr id="<%= dom_id(user) %>" class="user <%= "ban" if user.deleted? %>">
  <td width="100"><%= user.id %></td>
  <td width="32"><%= user_avatar_tag(user, :md) %></td>
  <td>
    <div class="flex items-center md:justify-between">
      <div class="username">
        <%= link_to user.fullname, user_path(user), target: "_blank" %>
      </div>
      <div class="flex items-center">
        <%= user_level_tag(user) unless user.member? %>
        <div class="ml-2 time">
          <%= icon_tag("clock") %> <%= user.created_at&.to_date %>
        </div>
      </div>
    </div>
    <% if user.bio.present? %>
      <div class="mt-2 description" title="Bio">
        <%= truncate user.bio, length: 300 %>
      </div>
    <% end %>
    <% if user.tagline.present? %>
      <div class="mt-2 description" title="Tagline">
        <%= truncate user.tagline %>
      </div>
    <% end %>
    <div class="mt-2 info">
      <% if user.topics_count > 0 %>
        <span class="badge"><%= user.topics_count %> Topics</span>
      <% end %>
      <% if user.replies_count > 0 %>
        <span class="badge"><%= user.replies_count %> Replies</span>
      <% end %>
    </div>
  </td>
  <td class="actions">
    <div class="btn-group">
      <%= link_to icon_tag("edit"), edit_admin_user_path(user.id), class: "btn" %>
      <% if !user.deleted? %>
        <%= link_to icon_tag("ban"), admin_user_path(user.id), class: "btn", method: :delete, remote: true, data: { confirm: "Are you sure to ban this user?" } %>
      <% end %>
    </div>
  </td>
</tr>
